<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .content{
      width: 200px;
      height: 200px;
      border: 1px solid #333;
      text-align: center;
      line-height: 200px;
      font-size: 30px;
    }
    button.active{
      background-color: red;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="changeTab(0)" :class="{active: num==0}">标题1</button>
    <button @click="changeTab(1)" :class="{active: num==1}">标题2</button>
    <button @click="changeTab(2)" :class="{active: num==2}">标题3</button>
    <div v-show=" num==0" class="content">内容1</div>
    <div v-show=" num==1" class="content">内容2</div>
    <div v-show=" num==2" class="content">内容3</div>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data:{
        num:0
      },
      methods: {
        changeTab(n){
          this.num = n
        }
      }
    })
  </script>
</body>
</html>